@extends('admin.frame_layout')
<?php $top_selected = "模式管理";$page_menu = "系统邮箱配置" ?>
@section('content')
    <form action="{{route('admin.config.save')}}" method="post" id="mode">
        {!! csrf_field() !!}
        <input type="hidden" name="_title" value="email"/>

        <div class="formbody">
            {{-- 基础奖金设置 --}}
            <div class="formtitle"><span>系统邮箱设置</span></div>
            <ul class="forminfo">

                {!! inputText("邮件发送驱动", "driver", "text",
                    cv("email.driver"),
                    '支持: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"！') !!}

                {!! inputText("邮件主机", "host", "text",
                    cv("email.host"),
                    '例: "smtp.163.com", "smtp.qq.com"！') !!}

                {!! inputText("服务端口号", "port", "text",
                    cv("email.port"),
                    '配置邮箱发送服务端口号！') !!}

                {!! inputText("加密类型", "encryption", "text",
                    cv("email.encryption"),
                    '可以设置为null表示不使用任何加密，也可以设置为tls/ssl！') !!}

                {!! inputText("邮箱帐号", "username", "text",
                    cv("email.username"),
                    '填写邮箱帐号！') !!}

                {!! inputText("用户名", "name", "text",
                    cv("email.name"),
                    '发送邮件使用的用户名！') !!}

                {!! inputText("客户端授权密码", "password", "password",
                    cv("email.password"),
                    '填写客户端授权密码！') !!}

                {{-- 保存按钮，必须放到最后一组当中 --}}
                <li>
                    <label class="lable">&nbsp;</label>
                    <input type="submit" class="btn" value="保存 并 立即生效"/>
                </li>
            </ul>

        </div>
    </form>
@endsection
@section('footer')
    <script type="text/javascript">
        $(function () {
            initCalcText();
            $(".calc").hover(function () {
                $(this).closest("div").find('i').show();
            }, function () {
                $(this).closest("div").find('i').hide();
            });

            $("#mode").validate({
                rules: {},
                errorPlacement: function (error, element) {
                },
                submitHandler: function (form) {
                    $(form).ajaxSubmit({
                        dataType: "json",
                        type: "post",
                        success: function (data) {
                            if (data.code == 0) {
                                toastr["success"](data.msg);
                                setInterval(function () {
                                    window.location.reload();
                                }, 2000);
                            } else {
                                toastr["error"](data.msg);
                            }
                        }
                    });
                }
            });
        });
    </script>
@endsection
